Skip to content

Disable gRPC fork support in PortableRunnerTestWithSubprocesses#38744

Merged
shunping merged 1 commit into
apache:masterfrom
shunping:disable-grpc-fork
May 29, 2026
Merged

Disable gRPC fork support in PortableRunnerTestWithSubprocesses#38744
shunping merged 1 commit into
apache:masterfrom
shunping:disable-grpc-fork

Conversation

@shunping
Copy link
Copy Markdown
Collaborator

@shunping shunping commented May 29, 2026

Applying the fix in #38566 to its parent class.

Redundant setup and teardown in the multi-worker subclass are removed to inherit them cleanly.

Test failure example:

________ PortableRunnerTestWithSubprocesses.test_custom_merging_window _________
[gw5] darwin -- Python 3.12.10 /Users/runner/work/beam/beam/sdks/python/target/.tox/py312-macos/bin/python

self = <apache_beam.runners.portability.portable_runner_test.PortableRunnerTestWithSubprocesses testMethod=test_custom_merging_window>

    def test_custom_merging_window(self):
>     with self.create_pipeline() as p:
           ^^^^^^^^^^^^^^^^^^^^^^

target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py:1284: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/pipeline.py:654: in __exit__
    self.result.wait_until_finish()
target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/portable_runner.py:572: in wait_until_finish
    raise self._runtime_exception
target/.tox/py312-macos/lib/python3.12/site-packages/apache_beam/runners/portability/portable_runner.py:581: in _observe_state
    for state_response in self._state_stream:
                          ^^^^^^^^^^^^^^^^^^
target/.tox/py312-macos/lib/python3.12/site-packages/grpc/_channel.py:538: in __next__
    return self._next()
           ^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_MultiThreadedRendezvous of RPC that terminated with:
	status = StatusCode.DEADLINE_EXCEEDED
	details = "Stream removed (Deadline Exceeded)"
	debug_error_string = "DEADLINE_EXCEEDED:Stream removed (Deadline Exceeded)"
>

 ...

target/.tox/py312-macos/lib/python3.12/site-packages/grpc/_channel.py:956: _MultiThreadedRendezvous
----------------------------- Captured stderr call -----------------------------
INFO:apache_beam.runners.portability.abstract_job_service:Running job 'job-b448bab8-ee74-4885-804c-2fbb1c2fc353'
INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting control server on port 51713
INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting data server on port 51714
INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting state server on port 51715
INFO:apache_beam.runners.portability.fn_api_runner.worker_handlers:starting logging server on port 51716
I0528 03:33:05.777477  106607 fork_posix.cc:71] Other threads are currently calling into gRPC, skipping fork() handlers

Avoids deadline exceeded failures in subprocess tests. Redundant setup and
teardown in the multi-worker subclass are removed to inherit them cleanly.
@shunping
Copy link
Copy Markdown
Collaborator Author

r: @derrickaw

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses intermittent test failures caused by gRPC fork support issues during subprocess execution. By centralizing the environment configuration in the base class and cleaning up redundant overrides in subclasses, the test suite becomes more stable and maintainable.

Highlights

  • gRPC Fork Support: Disabled gRPC fork support by setting the GRPC_ENABLE_FORK_SUPPORT environment variable to 'false' in the PortableRunnerTestWithSubprocesses class to prevent test failures.
  • Code Cleanup: Removed redundant setUpClass and tearDownClass methods from the PortableRunnerTestWithSubprocessesAndMultiWorkers subclass, allowing it to inherit the configuration cleanly from its parent.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors portable_runner_test.py by moving the setUpClass and tearDownClass methods, which manage the GRPC_ENABLE_FORK_SUPPORT environment variable, from PortableRunnerTestWithSubprocessesAndMultiWorkers to its parent class PortableRunnerTestWithSubprocesses to avoid duplication. The reviewer recommends using cls.addClassCleanup within setUpClass instead of a separate tearDownClass to ensure environment variables are cleaned up properly even if super().setUpClass() fails.

Comment thread sdks/python/apache_beam/runners/portability/portable_runner_test.py
@github-actions
Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@shunping shunping requested a review from derrickaw May 29, 2026 15:47
@shunping shunping merged commit f771827 into apache:master May 29, 2026
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants